<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>OA模拟与实现</title>
    <link rel="stylesheet" th:href="@{/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css}"></link>
    <script th:src="@{/js/jquery-3.2.1.min.js}"></script>
    <style>
      .tb{
          margin-top: 10px;
      }
    </style>
</head>
<body>
    <div class="container-fluid">
        <ol class="breadcrumb nav-top">
            <li><a th:href="@{~/router/index.html}" target="main">首页</a></li>
            <li class="active">教师管理</li>
        </ol>
        <form class="form-inline" action="" method="post">
            <div class="form-group">
              <label for="teaName">姓名：</label>
              <input type="text" class="form-control" name="tname" id="teaName" placeholder="请输入教师姓名">
            </div>
            <a href="" target="main" id="select" class="btn btn-primary">查询</a> <b>|</b>
            <a href="/user/toAddPeople" target="main" type="button" class="btn btn-primary">添加</a>
        </form>
        
        <!-- <button type="button" class="btn btn-primary">（首选项）Primary</button> -->
        <table class="table table-striped tb">
            <thead>
                <tr class="text-center">
                    <td>编&nbsp;号</td>
                    <td>姓&nbsp;名</td>
                    <td>入职日期</td>
                    <td>办公室</td>
                    <td>课&nbsp;程</td>
                    <td>职&nbsp;位</td>
                    <!--<td>操&nbsp;作</td>-->
                </tr>
            </thead>
            <tbody>
                <tr class="text-center" th:object="${people}" th:each="people : ${peopleList}">
                    <td th:text="*{oid}">001</td>
                    <td th:text="*{oname}">tom</td>
                    <td th:text="*{#dates.format(ointime,'yyyy-MM-dd')}">2019-6-9</td>
                    <td th:text="*{fid.location}">#501</td>
                    <td th:text="*{(cid == null)?('--'):(cid.coursename)}">操作系统</td>
                    <td th:text="*{pid.positionname}">讲师</td>
                    <td>
                        <!--<a th:href="'/user/toEdit/'+*{oid}">编辑</a>&nbsp;|&nbsp;-->
                        <!--<a th:href="@{/user/delete/{id}(id=*{oid})}">删除</a>-->
                    </td>
                </tr>
            </tbody>
            
        </table>
        <div class="text-center">
            <nav aria-label="Page navigation">
                <ul class="pagination">
                  <li>
                    <a id="pre" th:href="'/user/teacher.html?currentPage='+${currentPage - 1==0?1:currentPage - 1}+'&tname='+${tname}" aria-label="Previous">
                      <span aria-hidden="true">&laquo;</span>
                    </a>
                  </li>

                  <li th:each="page : ${#numbers.sequence(1,totalPage)}"><a id="curr" th:href="@{/user/teacher.html(currentPage=${page},tname=${tname})}" th:text="${page}"></a></li>

                  <li>
                    <a id="next" th:href="@{/user/teacher.html(currentPage=${currentPage==totalPage?totalPage:currentPage+1},tname=${tname})}" aria-label="Next">
                      <span aria-hidden="true">&raquo;</span>
                    </a>
                  </li>
                </ul>
              </nav>
        </div>
    </div>
</body>
<script>
    $(function(){
        $("#select").click(function(){
            var tname = $("#teaName").val();
            var href = "/user/teacher.html?tname="+tname;
            $(this).attr("href",href);
        })
    })
</script>
</html>